#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
	int a = 10;
	printf("hello\n");
	pid_t son = vfork();
	if(son > 0)
	{
		printf("我是父进程\n");
		printf("当前的pid=%d\n", getpid());
		printf("当前的父进程的pid=%d\n", getppid());
		printf("a=%d\n", a); // 100
		wait(NULL);
	}
	else if (son == 0)
	{
		printf("我是子进程\n");
		printf("当前的pid=%d\n", getpid());
		printf("当前的父进程的pid=%d\n", getppid());
		a=100;
		exit(0);
	}
	printf("world\n");
	
	return 0;
}
